package com.base.controller;

import com.base.po.tbk.TbkGoodGoods;
import com.base.po.voip.Users;
import com.base.service.TbkGoodGoodsService;
import com.base.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 好货专场
 *
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/admin")
public class index_GoodGoods {
	@Autowired
	private TbkGoodGoodsService tbkGoodGoodsService;
	@Autowired
	private UsersService usersService;

	// 好货专场首页
	@RequestMapping("/goodGoodsIndex")
	public ModelAndView index(HttpServletRequest request, String contentId) throws Exception {
		// 返回ModelAndView
		ModelAndView modelAndView = new ModelAndView();
		String adminUserId = (String) request.getSession().getAttribute("adminUserId");
		Users users = usersService.selectByPrimaryKey(adminUserId);

		List<TbkGoodGoods> tbkGoodGoods = tbkGoodGoodsService.selectByContentId(adminUserId, contentId);

		request.setAttribute("tbkGoodGoods", tbkGoodGoods);
		// 设置页面进行跳转
		modelAndView.setViewName("jsp/index_GoodGoods");
		return modelAndView;
	}
}
